package com.sss.controller.admin;

import com.sss.controller.BaseController;
import com.sss.service.AdminService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import java.util.Map;

@Controller
public class AdminHomeController extends BaseController {
    @Resource(name = "adminService")
    private AdminService adminService;

    //转到后台管理-主页
    @RequestMapping(value = "admin/home",method = RequestMethod.GET)
    public String goToPage(HttpSession session, Map<String,Object> map){
        logger.info("检查管理员权限");
        Object adminId=checkAdmin(session);
        if (adminId==null){
            return "redirect:/admin/login";
        }
        return "admin/homePage";
    }
    //后台控制台-页面
    @RequestMapping(value = "admin/control",method = RequestMethod.GET)
    public String goTopage(HttpSession session,Map<String,Object> map){
        logger.info("检查管理员权限");
        Object adminId=checkAdmin(session);
        if (adminId==null){
            return "redirect:/admin/login";
        }
        return "admin/admincontrol";
    }

}
